﻿using ProjectManager.Logic.Content;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProjectManager.UnderLogic
{
    internal static class InfoToString
    {
        public static string ToSqlString(this ProjectInformation projectInformation)
        {
            return $"'{projectInformation.Url}', '{projectInformation.Path}', '{projectInformation.Name}'" +
                $", '{projectInformation.TaskPath}', '{projectInformation.MemberPath}'";
        }
        public static string ToSqlKeyString(this ProjectInformation projectInformation)
        {
            return $"Url = \"{projectInformation.Url}\", Path = \"{projectInformation.Path}\", Name = \"{projectInformation.Name}\"" +
                $", TaskPath = \"{projectInformation.TaskPath}\", MemberPath = \"{projectInformation.MemberPath}\"";
        }
        public static string ToSqlString(this MemberInformation memberInformation)
        {
            return $"'{memberInformation.ID}', '{memberInformation.Name}'";
        }
        public static string ToSqlKeyString(this MemberInformation memberInformation)
        {
            return $"MemberID = \"{memberInformation.ID}\", MemberName = \"{memberInformation.Name}\"";
        }
        public static string ToSqlString(this ProjectTaskInformation projectTaskInformation)
        {
            // (TeamID, BranchName, Name, Description, protectedPaths, StartDate, EndDate, Status, ChildTasks)
            return $"'{projectTaskInformation.TeamID}', '{projectTaskInformation.BranchName}'" +
                $", '{projectTaskInformation.Name}', '{projectTaskInformation.Description}'" +
                $", '{string.Join(",", projectTaskInformation.protectedPaths)}'" + 
                $", '{projectTaskInformation.StartDate}', '{projectTaskInformation.EndDate}', '{projectTaskInformation.Status}'" +
                $", '{string.Join(",", projectTaskInformation.ChildTask.Select(x => x.ID.ToString()))}'";
        }
    }
}
